package edu.infomatik.tundra.pages;

import java.util.ArrayList;
import java.util.List;

import org.apache.tapestry5.annotations.Property;
import org.apache.tapestry5.annotations.SessionState;
import org.apache.tapestry5.ioc.Messages;
import org.apache.tapestry5.ioc.annotations.Inject;

import edu.infomatik.tundra.data.DAOtundra;
import edu.infomatik.tundra.data.IBean;
import edu.infomatik.tundra.logic.SprintBean;
import edu.infomatik.tundra.logic.SprintMetrics;
import edu.infomatik.tundra.logic.UStoryBean;
import edu.infomatik.tundra.logic.WorkBean;
import edu.infomatik.tundra.logic.WorkKinds;
import edu.infomatik.tundra.logic.security.SystemAccessBean;

@SuppressWarnings("unused")
public class TheSprint {
	@SessionState
	private WorkBean project;
	private boolean projectExists;

	@SessionState
	private SystemAccessBean user;
	private boolean userExists;
	@SessionState
	private Boolean newWork=new Boolean(false);
	
	@SessionState
	@Property
	private SprintBean sprint;
	
	@Inject
	private Messages message;
	
	public String getProjectName(){
		return project.getName();
	}
	
	public String getMetrics(){
		return message.get("SprintMetrics."+SprintMetrics.get(sprint.getMetrics()).getName());
	}

	String onActivate(){
		if (!userExists) return "Index";
		else if (!projectExists) return "ProjectList"; 
		return null;
	}
	
}
